Array
Functions
|
GetArrayItem(Array$,SeparatorChar$,Position)
|
|
|
|
This function returns item from
Array$
at defined Position.
SeparatorChar$
is an array
delimiter character.
Remember
that each array
item must be delimited
by separator character.
In fact, it can
be any character
from ASCII table
(0-255), but we
recommend to use
less usual characters
(#, *, /,|...).
Extended characters
(127-255) can be
added by CHR(number)
code.
|
|
|
|
|
This
code show item1..item5
in message box. Items$ =
'item1#item2#item3#item4#item5#'
For i = 1 To 5
ArrayItem$ =
GetArrayItem(Items$,#,i)
Message("Obtained array item:
","ArrayItem$")
Next i
Here
is more advanced
example:
This
code returns
selected item(s)
from ListBox object
ListBoxGetSelectedItems("ListBox","Items$,ItemsNum$,#,NumItems")
For
i=NumItems To
1
ArrayItem$
= GetArrayItem(Items$,#,i)
Message("Selected
item: ","ArrayItem$")
Next
i
|
|
|
|
|
Coma
(,) character cannot
be used as an array delimiter.
|
|
|
GetArrayNum(Array$,SeparatorChar$)
|
|
|
|
This function returns a number of Items in the Array$
with predefined delimiter (SeparatorChar$).
This function is useful in cases if you don't know the number of
items in the
array.
|
|
|
|
|
This
code show item1..item5
in message box. Items$ =
'item1#item2#item3#item4#item5#'
NumOfItems=GetArrayNum(Items$,#) For i = 1 To NumOfItems
ArrayItem$ =
GetArrayItem(Items$,#,i)
Message("Obtained array item:
","ArrayItem$")
Next i
|
|
|
|
MMB Scripting Unleashed by
Bokzy, 2003
:: All rights reserved ::
http://www.bokzy.com
|